//
// Created by Snow on 2023/3/9.
//
#include<cstdlib>
#include<cstdio>
typedef char ElemType;
typedef struct LinkNode
{
    ElemType data;
    struct LinkNode *next;
}LinkStNode;
void InitStack(LinkStNode *&s)
{
    s=(LinkStNode *)malloc(sizeof(LinkStNode));
    s->next=nullptr;
}
void DestroyStack(LinkStNode *&s)
{
    LinkStNode *p=s->next,*pre=s;
    while(p!=nullptr)
    {
        free(pre);
        pre=p;
        p=p->next;
    }
    free(pre);
}
bool StackEmpty(LinkStNode *s)
{
    return(s->next==nullptr);
}
bool Push(LinkStNode *&s,ElemType e)
{
    LinkStNode *p;
    p=(LinkStNode *)malloc(sizeof(LinkStNode));
    p->data=e;
    p->next=s->next;
    s->next=p;
    return true;
}
bool Pop(LinkStNode *&s,ElemType &e)
{
    LinkStNode *p;
    if(s->next==nullptr)
        return false;
    p=s->next;
    e=p->data;
    s->next=p->next;
    free(p);
    return true;
}
bool GetTop(LinkStNode *s,ElemType &e)
{
    if(s->next==nullptr)
        return false;
    e=s->next->data;
    return true;
}
bool Match(char exp[],int n)
{
    int i=0;
    char e;
    bool match=true;
    LinkStNode *st;
    InitStack(st);
    while(i<n&&match)
    {
        if(exp[i]=='(')
            Push(st,exp[i]);
        else if(exp[i]==')')
        {
            if(GetTop(st,e))
            {
                if(e!='(')
                    match= false;
                else
                    Pop(st,e);
            }
            else match= false;
        }
        i++;
    }
    if(!StackEmpty(st))
    {
        match=false;
    }
    DestroyStack(st);
    return match;
}
int main()
{
    char exp[]="(a)";
    if(Match(exp,2))
        printf("yes\n");
    else
        printf("no\n");
}